package com.dmpp.mes.controller;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.parameterInfo.Aroma;
import com.dmpp.mes.parameterInfo.SemiType;
import com.dmpp.mes.service.AromaService;
import com.dmpp.mes.service.SemiTypeService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("SemiType")
public class SemiTypeController {
//半成品类型
    @Autowired
    private SemiTypeService service;


    @RequestMapping(value = "/FindAll", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findAll(Integer page, Integer pageSize,SemiType semiType) {
        PageHelper.startPage(page, pageSize);
        return service.findAll(semiType);
    }

    @RequestMapping(value = "/FindByCode", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findByCode(String code) {
        return service.findByCode(code);
    }

    @RequestMapping(value = "/Insert", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData insert(SemiType semiType) {
        return service.insert(semiType);
    }

    @RequestMapping(value = "/UpdateByCode", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateByCode(SemiType semiType) {
        return service.updateByCode(semiType);
    }

    @RequestMapping(value = "/DeleteByCode", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData deleteByCode(String code) {
        return service.deleteByCode(code);
    }

    @RequestMapping(value = "/Delete", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData delete(String code) {
        return service.delete(code);
    }
}
